package com.example.android.utils.api;

import androidx.lifecycle.LiveData;

import com.example.android.bean.AddReleaseInfo;
import com.example.android.bean.BaseModelTable;
import com.example.android.bean.CarDetailInfo;
import com.example.android.bean.CarRelease;
import com.example.android.utils.BaseModel;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;

/**
 * 预约模块请求api
 */
public interface CarReleaseApi {
    /**
     * 获得所有的可以预约的信息
     *
     * @return
     */
    @POST("/release/list")
    LiveData<BaseModelTable<CarRelease>> getPublicRelease(@Body CarRelease carRelease);

    /**
     * 获得用户的预约信息
     *
     * @return
     */
    @POST("/release/listMe")
    Call<BaseModelTable<CarRelease>> getMeRelease(@Body CarRelease carRelease);

    /**
     * 保存
     *
     * @param carRelease
     * @return
     */
    @POST("/release")
    Call<BaseModel<String>> saveRelease(@Body CarRelease carRelease);

    @PUT("/release")
    Call<BaseModel<String>> editRelease(@Body CarRelease carRelease);

    /**
     * 审核发布信息
     *
     * @param id 发布信息ID
     * @return
     */
    @POST("/release/review/{id}")
    Call<BaseModel<String>> reviewRelease(@Path("id") Long id);

    /**
     * 获得自己的发布汽车信息
     *
     * @return
     */
    @GET("/release/mePublicReleaseInfo/{isPublic}")
    LiveData<BaseModel<List<AddReleaseInfo>>> mePublicRelease(@Path("isPublic") Boolean isPublic);

    /**
     * 获得汽车所有的信息进行展示
     * @param carId
     * @return
     */
    @GET("/release/getDetailAllSystemInfo/{carId}")
    LiveData<BaseModel<CarDetailInfo>> getDetailSystemInfo(@Path("carId") Long carId);
}
